package com.msa.msaportal.util;

import java.rmi.RemoteException;
import java.util.HashSet;
import java.util.Set;

import javax.annotation.Resource;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import com.msa.msaportal.common.web.ConstantUntil;
import com.msa.msaportal.common.web.MsaJsonUntil;
import com.msa.msaportal.entity.UserComponent;
import com.msa.msaportal.service.IUserComponentService;
import com.msa.msaportal.webservice.WebServiceTools;

public class RevokeThread extends Thread{
	@Resource(name="userComponentManager")
	private IUserComponentService userComponentManager;
	private String revokeArray;
	public RevokeThread(String revokeArray) {
		super();
		this.revokeArray=revokeArray;
	}
	public synchronized void run() {
		try {
			userComponentManager=(IUserComponentService)SpringTool.getBean("userComponentManager");
			this.revoke();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	synchronized void revoke() {
		System.out.println("回收线程");
		JSONArray revokeJSONArray=JSONArray.fromObject(revokeArray);
		System.out.println("revokeArray"+revokeArray);
		for(int i=0;i<revokeJSONArray.size();i++){
			try {
				String userId=revokeJSONArray.getJSONObject(i).getString("userId");
				JSONObject userDetail = JSONObject.fromObject(MsaJsonUntil.getJsonByUserId(userId));
				System.out.println(userDetail);
				String orgCode = userDetail.getJSONObject("datas").getJSONObject("table").getJSONObject("row").getString("organizations");
				String deptCode = userDetail.getJSONObject("datas").getJSONObject("table").getJSONObject("row").getString("departments");
				JSONArray jsonarry = userDetail.getJSONObject("datas").getJSONObject("table").getJSONObject("row").getJSONArray("table").getJSONObject(0).getJSONArray("row");
				Set<String> roleSet=new HashSet<String>();
				for(int j=0;j<jsonarry.size();j++){
					roleSet.add(jsonarry.getJSONObject(j).getString("roleCode"));
				}
				if(roleSet.contains("CMP_001_R00011")){//部门层级管理员 
					System.out.println("Dept Manager");
					String url = "http://msa-xtgl-soa1:8011//CommissionInvoke/proxy/ContractLDAPService_BJproxy?wsdl";
					String methods = "getUsersByDeptNO";
					String parameter = deptCode;
					try {
						//[{"uid":"350122198302107322","orgnazations":"08","givenname":"林爱慧","mobile":"13800000072","officePhone":"0591-83838301","sn":"林爱慧","orgName":"福建海事局","mail":"linaihui@msa.gov.cn","orderNum":"-1","ismanager":"否","departments":"080014","userStatus":"Active","userType":"正式用户"},{"uid":"350203196211031059","orgnazations":"08","givenname":"李杰","mobile":"15959181669","officePhone":"83838860","sn":"李杰","orgName":"福建海事局","mail":"lijie006@msa.gov.cn","orderNum":"-1","ismanager":"是","departments":"080014","userStatus":"Active","userType":"正式用户"},{"uid":"350423197510090017","orgnazations":"08","givenname":"林晨","mobile":"13800000067","officePhone":"0591-83838301","sn":"林晨","orgName":"福建海事局","mail":"linchen@msa.gov.cn","orderNum":"-1","ismanager":"否","departments":"080014","userStatus":"Active","userType":"正式用户"},{"uid":"350429197404040014","orgnazations":"08","givenname":"徐永辉","mobile":"13805095360","sn":"徐永辉","orgName":"福建海事局","mail":"xuyonghui@msa.gov.cn","orderNum":"-1","ismanager":"否","departments":"080014","userStatus":"Active","userType":"正式用户"},{"uid":"350521197612280017","orgnazations":"08","givenname":"林新宇","mobile":"13800000070","officePhone":"0591-83838301","sn":"林新宇","orgName":"福建海事局","mail":"linxinyu@msa.gov.cn","orderNum":"-1","ismanager":"否","departments":"080014","userStatus":"Active","userType":"正式用户"},{"uid":"350583198711282636","orgnazations":"08","givenname":"苏智鹏","mobile":"15806083260","sn":"苏智鹏","orgName":"福建海事局","mail":"suzhipeng@msa.gov.cn","orderNum":"-1","ismanager":"否","departments":"080014","userStatus":"Active","userType":"正式用户"},{"uid":"350626198312030528","orgnazations":"08","givenname":"林晓静","mobile":"13800000071","officePhone":"0591-83838301","sn":"林晓静","orgName":"福建海事局","mail":"linxiaojing@msa.gov.cn","orderNum":"-1","ismanager":"否","departments":"080014","userStatus":"Active","userType":"正式用户"},{"uid":"352224197301270027","orgnazations":"08","givenname":"林静","mobile":"13800000069","officePhone":"0591-83838301","sn":"林静","orgName":"福建海事局","mail":"linjing001@msa.gov.cn","orderNum":"-1","ismanager":"否","departments":"080014","userStatus":"Active","userType":"正式用户"},{"uid":"440804195608162010","orgnazations":"08","givenname":"柳秉坦","mobile":"13800000068","officePhone":"0591-83838301","sn":"柳秉坦","orgName":"福建海事局","mail":"liubingtan@msa.gov.cn","orderNum":"-1","ismanager":"否","departments":"080014","userStatus":"Active","userType":"正式用户"}]
						JSONArray users=JSONArray.fromObject(WebServiceTools.getDataByUrl(url, methods, parameter));
						System.out.println("Dept users:"+users);
						for(int z=0;z<users.size();z++){	
							UserComponent userComponent=new UserComponent(users.getJSONObject(z).getString("uid"),revokeJSONArray.getJSONObject(i).getString("componentId"));
							System.out.println("revoke:"+userComponent);
							userComponentManager.deleteUserComponent(userComponent);
						}
					
					} catch (Exception e) {
						e.printStackTrace();
					}
				}else if(roleSet.contains("CMP_001_R00005")&&orgCode!="08"){//非省局机构层级管理员
						System.out.println("org Manager");
						String url = "http://msa-xtgl-soa1:8011/CommissionInvoke/proxy/LDAPService_BJproxy?wsdl";
						String methods = "UserQueryServices_userQueryByCondition";
						String parameter = "{'orgCode':'"+orgCode+"','pageSize':'3000','currentPage':'1'}";
						try {
							//{"result":"1","info":"用户查询成功","datas":{"table":{"tableName":"tmp_pgCount","row":{"total":71,"pageSize":"3000","pages":1,"currentPage":"1","table":{"tableName":"user","row":[{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","position":"11","dutyGrade":"11","idNumber":"123456789123456782","userId":"123456789123456782","uid":"123456789123456782","userName":"你好人","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"18963984846","userType":"正式用户","orderNum":"1"},{"ismanager":"否","workType":"公务员编制","position":"321","dutyGrade":"321","idNumber":"21122319900701082o","userId":"21122319900701082o","uid":"21122319900701082o","userName":"测试三手机","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000001","deptName":"局领导","userType":"非正式用户","orderNum":"21"},{"ismanager":"否","workType":"公务员编制","idNumber":"21122319900701083u@b","userId":"21122319900701083u@b","uid":"21122319900701083u@b","userName":"测试十五","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000015","deptName":"信息科技处","userType":"非正式用户","orderNum":"123"},{"userId":"XELSYSADM","uid":"XELSYSADM","userName":"System","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","deptCode":"000015","deptName":"信息科技处"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"11010119570626501X","userId":"11010119570626501X","uid":"11010119570626501X","userName":"智广路","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","deptCode":"000001","deptName":"局领导","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"14260197911261329","userId":"14260197911261329","uid":"14260197911261329","userName":"董瑜芳","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","deptCode":"000001","deptName":"局领导","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"110108195709164913","userId":"110108195709164913","uid":"110108195709164913","userName":"张双喜","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","deptCode":"000001","deptName":"局领导","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"120103197502204518","userId":"120103197502204518","uid":"120103197502204518","userName":"王勇","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13794961627","deptCode":"000005","deptName":"财务会计处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"110108195607214932","userId":"110108195607214932","uid":"110108195607214932","userName":"郑和平","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","deptCode":"000001","deptName":"局领导","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"320981198004290710","userId":"320981198004290710","uid":"320981198004290710","userName":"姚亮","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","deptCode":"000005","deptName":"财务会计处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","workType":"公务员编制","dutyGrade":"11","idNumber":"000000000000000009","userId":"000000000000000009","uid":"000000000000000009","userName":"4A系统管理员","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"440111197910090067","userId":"440111197910090067","uid":"440111197910090067","userName":"陈翔华","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","issms":"否","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"341125198603253807","userId":"341125198603253807","uid":"341125198603253807","userName":"陈倩","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000005","deptName":"财务会计处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"110108195810124916","userId":"110108195810124916","uid":"110108195810124916","muId":"11111","userName":"张志刚","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000005","deptName":"财务会计处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"320924198010064376","userId":"320924198010064376","uid":"320924198010064376","userName":"张庆文","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000005","deptName":"财务会计处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"370102198110214519","userId":"370102198110214519","uid":"370102198110214519","userName":"王田","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000005","deptName":"财务会计处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"210204195801100975","userId":"210204195801100975","uid":"210204195801100975","userName":"何铁华","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000005","deptName":"财务会计处","userStatus":"Active","userType":"正式用户"},{"ismanager":"是","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"110108195911294957","userId":"110108195911294957","uid":"110108195911294957","userName":"许如清","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000005","deptName":"财务会计处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=xelsysadm,ou=users,dc=CMP","workType":"公务员编制","idNumber":"231026197512132912","userId":"231026197512132912","uid":"231026197512132912","userName":"李伟","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13589899999","issms":"否","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"320107195701033436","userId":"320107195701033436","uid":"320107195701033436","userName":"陈爱平","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000001","deptName":"局领导","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=xelsysadm,ou=users,dc=CMP","workType":"公务员编制","idNumber":"370203195909152636","userId":"370203195909152636","uid":"370203195909152636","userName":"李世新","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"18312341234","deptCode":"000001","deptName":"局领导","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"372301197111182418","userId":"372301197111182418","uid":"372301197111182418","userName":"吴延国","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=xelsysadm,ou=users,dc=CMP","workType":"公务员编制","idNumber":"330726198108232319","userId":"330726198108232319","uid":"330726198108232319","userName":"吴文正","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"1351234321","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","dutyGrade":"11","idNumber":"000000000000000000","userId":"000000000000000000","uid":"000000000000000000","userName":"4A系统管理员","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13803681058","issms":"是","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"370102196608073419","userId":"370102196608073419","uid":"370102196608073419","userName":"崔景波","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13812341","issms":"否","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=xelsysadm,ou=users,dc=CMP","workType":"公务员编制","idNumber":"130224198202036819","userId":"130224198202036819","uid":"130224198202036819","userName":"王汝岩","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","issms":"否","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","manager":"uid=uid=XELSYSADM,ou=users,dc=CMP,ou=users,dc=CMP","workType":"公务员编制","idNumber":"430103197410231036","userId":"430103197410231036","uid":"430103197410231036","userName":"李剑雄","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"5555444464646","deptCode":"000005","deptName":"财务会计处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","position":"无岗位","dutyGrade":"无级别","idNumber":"21122319900701083m","userId":"21122319900701083m","uid":"21122319900701083m","userName":"测试为","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000015","deptName":"信息科技处","userType":"非正式用户","orderNum":"-1"},{"ismanager":"否","workType":"公务员编制","idNumber":"21122319900701083o","userId":"21122319900701083o","uid":"21122319900701083o","userName":"测试问","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000015","deptName":"信息科技处","userType":"非正式用户","orderNum":"-1"},{"ismanager":"否","workType":"公务员编制","idNumber":"21122319900701083l","userId":"21122319900701083l","uid":"21122319900701083l","userName":"测试哦","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000015","deptName":"信息科技处","userType":"非正式用户","orderNum":"-1"},{"ismanager":"否","workType":"公务员编制","idNumber":"21122319900701083f","userId":"21122319900701083f","uid":"21122319900701083f","userName":"测试吗","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000015","deptName":"信息科技处","userType":"正式用户","orderNum":"-1"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"21122319900701083b","userId":"21122319900701083b","uid":"21122319900701083b","userName":"测试拔","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000015","deptName":"信息科技处","userType":"非正式用户","orderNum":"-1"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","position":"123","dutyGrade":"123","idNumber":"21122319900701083y","userId":"21122319900701083y","uid":"21122319900701083y","userName":"测试十一","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000015","deptName":"信息科技处","userType":"正式用户","orderNum":"-1"},{"ismanager":"否","workType":"公务员编制","idNumber":"21122319900701083i","userId":"21122319900701083i","uid":"21122319900701083i","userName":"测试十七","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000015","deptName":"信息科技处","userType":"正式用户","orderNum":"-1"},{"ismanager":"否","workType":"公务员编制","idNumber":"21122319900701083u@s","userId":"21122319900701083u@s","uid":"21122319900701083u@s","userName":"测试十五","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000015","deptName":"信息科技处","userType":"非正式用户","orderNum":"-1"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"21122319900701083u@v","userId":"21122319900701083u@v","uid":"21122319900701083u@v","userName":"测试十五","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"非正式用户","orderNum":"-1"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"21122319900701083u","userId":"21122319900701083u","uid":"21122319900701083u","userName":"测试十五","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户","orderNum":"-1"},{"idNumber":"009117","userId":"009117","uid":"009117","muId":"2ba839b355d14f5a9ab446a9ad7d8b3e","userName":"009117张三1","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00"},{"idNumber":"009118","userId":"009118","uid":"009118","muId":"ec09fbe05ee24315a6d303256b289a7d","userName":"009118张三1","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00"},{"idNumber":"009129","userId":"009129","uid":"009129","muId":"4214c2658c8343ce95a0518e75edfe4b","userName":"009112张三1","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00"},{"idNumber":"009139","userId":"009139","uid":"009139","muId":"0ffe84b9df4d49c98aea906b820cbe7b","userName":"009132张三1","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00"},{"idNumber":"009149","userId":"009149","uid":"009149","muId":"59467d3e09d34a14ac600d1d172d806d","userName":"009142张三1","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00"},{"idNumber":"009159","userId":"009159","uid":"009159","muId":"8392b89acdcc4f8282391804500dd443","userName":"009139张三6","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00"},{"idNumber":"009169","userId":"009169","uid":"009169","muId":"fd3e269daa834b57ac79303810d6f3d0","userName":"009162张三1","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00"},{"idNumber":"009179","userId":"009179","uid":"009179","userName":"009182张三1","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"410327198405111032","userId":"410327198405111032","uid":"410327198405111032","userName":"王明辉","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000005","deptName":"财务会计处","userStatus":"Active","userType":"正式用户","orderNum":"-1"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"211223199007010000","userId":"211223199007010000","uid":"211223199007010000","userName":"测试五","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","issms":"否","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"211223199007010827","userId":"211223199007010827","uid":"211223199007010827","userName":"测试七","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000018","deptName":"党组工作部（组织处）","userStatus":"Active","userType":"正式用户","orderNum":"-1"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"310109197302274013@msa","userId":"310109197302274013@msa","uid":"310109197302274013@msa","userName":"朱骏","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000004","deptName":"计划装备处","userStatus":"Active","userType":"非正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"211223199007010832@b","userId":"211223199007010832@b","uid":"211223199007010832@b","userName":"哈哈哈","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"1234567","deptCode":"000001","deptName":"局领导","userStatus":"Active","userType":"非正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"341221199209262575","userId":"341221199209262575","uid":"341221199209262575","userName":"伟大","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"18863384540","deptCode":"000005","deptName":"财务会计处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"341221199209262579","userId":"341221199209262579","uid":"341221199209262579","userName":"尾盘","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"18863384540","deptCode":"000009","deptName":"危管防污处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"000000000000000999","userId":"000000000000000999","uid":"000000000000000999","userName":"添加测试","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"130224198202036309","userId":"130224198202036309","uid":"130224198202036309","userName":"王汝岩","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","issms":"否","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"130224198202036149","userId":"130224198202036149","uid":"130224198202036149","userName":"王汝岩","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","issms":"否","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","position":"测试","idNumber":"410526198610174444","userId":"410526198610174444","uid":"410526198610174444","userName":"李晓","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13783409618","deptCode":"000001","deptName":"局领导","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","position":"测试","idNumber":"410526198610174444@ABC","userId":"410526198610174444@ABC","uid":"410526198610174444@ABC","userName":"李晓","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13783409618","deptCode":"000017","deptName":"审计处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","position":"测试","idNumber":"410526198610174444@QWE","userId":"410526198610174444@QWE","uid":"410526198610174444@QWE","userName":"李晓","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13783409618","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"社会用工","idNumber":"410526198610175559","userId":"410526198610175559","uid":"410526198610175559","userName":"测试","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13784849828","issms":"否","deptCode":"000003","deptName":"政策法规处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"341221199209263154","userId":"341221199209263154","uid":"341221199209263154","userName":"给变","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"18863384540","deptCode":"000001","deptName":"局领导","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"341221199209262514@AWE","userId":"341221199209262514@AWE","uid":"341221199209262514@AWE","userName":"尾盘","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","deptCode":"000003","deptName":"政策法规处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"000000000000000915@ABD","userId":"000000000000000915@ABD","uid":"000000000000000915@ABD","userName":"添加测试","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","deptCode":"000003","deptName":"政策法规处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"410327198405111013@ALZ","userId":"410327198405111013@ALZ","uid":"410327198405111013@ALZ","userName":"王明辉","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","deptCode":"000007","deptName":"通航管理处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"000000000000000913@ACR","userId":"000000000000000913@ACR","uid":"000000000000000913@ACR","userName":"添加测试","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","deptCode":"000001","deptName":"局领导","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"410526201309110099","userId":"410526201309110099","uid":"410526201309110099","userName":"测试局","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13783409618","issms":"否","deptCode":"000009","deptName":"危管防污处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"130224198202036850","userId":"130224198202036850","uid":"130224198202036850","userName":"王汝岩","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","issms":"��","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"130224198202036385","userId":"130224198202036385","uid":"130224198202036385","userName":"王汝岩","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","issms":"否","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"130224198202036258","userId":"130224198202036258","uid":"130224198202036258","userName":"王汝岩","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","issms":"否","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","position":"无岗位","dutyGrade":"无级别","idNumber":"000000000001111111","userId":"000000000001111111","uid":"000000000001111111","userName":"测试","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13512344321","issms":"否","deptCode":"000015","deptName":"信息科技处","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"社会用工","idNumber":"410526198610178888","userId":"410526198610178888","uid":"410526198610178888","userName":"测试局","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13783409618","deptCode":"000001","deptName":"局领导","userStatus":"Active","userType":"正式用户"},{"ismanager":"否","credentialsType":"身份证","workType":"公务员编制","idNumber":"410526198610179910","userId":"410526198610179910","uid":"410526198610179910","userName":"测试测","orgCode":"00","orgName":"交通部海事局","maritimeOrgCode":"00","mobile":"13783409618","deptCode":"000001","deptName":"局领导","userStatus":"Active","userType":"正式用户"}]}}}}}
							JSONObject objectResult=JSONObject.fromObject(WebServiceTools.getDataByUrl(url, methods, parameter));
							if("1".equals(objectResult.getString("result"))){
								JSONArray users=objectResult.getJSONObject("datas").getJSONObject("table").getJSONObject("row").getJSONObject("table").getJSONArray("row");
								System.out.println("Org users:"+users);
								for(int z=0;z<users.size();z++){	
									UserComponent userComponent=new UserComponent(users.getJSONObject(z).getString("uid"),revokeJSONArray.getJSONObject(i).getString("componentId"));
									System.out.println("revoke:"+userComponent);
									userComponentManager.deleteUserComponent(userComponent);
								}
							}					
						} catch (Exception e) {
							e.printStackTrace();
						}
					
				}
				UserComponent userComponent=new UserComponent(revokeJSONArray.getJSONObject(i).getString("userId"),revokeJSONArray.getJSONObject(i).getString("componentId"));
				userComponentManager.deleteUserComponent(userComponent);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
